﻿namespace Agent.Dialogs
{
    using Agent;
    using System;
    using System.CodeDom.Compiler;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Markup;

    [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
    public class IcqEmail : Window, IComponentConnector
    {
        private bool a;
        internal TextBox b;
        internal Label c;
        internal Button d;
        internal Button e;
        private bool f;

        public IcqEmail(bool A_0)
        {
            this.InitializeComponent();
            this.a = A_0;
            if (A_0)
            {
                this.c.Content = e.c("NewIcq");
            }
            else
            {
                this.c.Content = e.c("NewEmail");
            }
            this.e.Content = e.c("Cancel");
            this.d.Content = e.c("Change");
        }

        [DebuggerNonUserCode, EditorBrowsable(EditorBrowsableState.Never)]
        private void a(int A_0, object A_1)
        {
            switch (A_0)
            {
                case 1:
                    this.b = (TextBox) A_1;
                    return;

                case 2:
                    this.c = (Label) A_1;
                    return;

                case 3:
                    this.d = (Button) A_1;
                    this.d.Click += new RoutedEventHandler(this.btnChange_Click);
                    return;

                case 4:
                    this.e = (Button) A_1;
                    this.e.Click += new RoutedEventHandler(this.btnCancel_Click);
                    return;
            }
            this.f = true;
        }

        private void btnCancel_Click(object A_0, RoutedEventArgs A_1)
        {
            base.Close();
        }

        private void btnChange_Click(object A_0, RoutedEventArgs A_1)
        {
            if (!string.IsNullOrWhiteSpace(this.b.Text))
            {
                if (this.a)
                {
                    if (WebRequestManager.f(this.b.Text))
                    {
                        MessageBox.Show(e.c("ICQChangingSucceed"));
                    }
                    else
                    {
                        MessageBox.Show(e.c("ICQChangingNotSucceed"));
                    }
                }
                else
                {
                    MessageBox.Show(WebRequestManager.g(this.b.Text));
                }
                base.Close();
            }
            else if (this.a)
            {
                MessageBox.Show(e.c("InvalidICQ"));
            }
            else
            {
                MessageBox.Show(e.c("InvalidEmail"));
            }
        }

        [DebuggerNonUserCode]
        public void InitializeComponent()
        {
            if (!this.f)
            {
                this.f = true;
                Uri resourceLocator = new Uri("/TheSafety;component/dialogs/icqemail.xaml", UriKind.Relative);
                Application.LoadComponent(this, resourceLocator);
            }
        }
    }
}

